local skel = fk.CreateSkill {
  name = "lb_zero__lieshi",
  tags = { Skill.Compulsory },
  --[[
  max_branches_use_time = {
    ["basic"] = {
      [Player.HistoryRound] = 1
    },
    ["trick"] = {
      [Player.HistoryRound] = 1
    },
    ["equip"] = {
      [Player.HistoryRound] = 1
    },
  }
  --]]
}

Fk:loadTranslationTable {
  ["lb_zero__lieshi"] = "烈势",
  --[":lb_zero__lieshi"] = "<b>锁定技</b>，每轮每类型各限一次，当你使用非虚拟牌时，你依次询问距离1以内的其他角色是否令你摸一张牌，若其选否，你视为对其使用一张火【杀】。",
  --11.7
  [":lb_zero__lieshi"] = "<b>锁定技</b>，每回合限一次，当你使用非虚拟牌时，你询问相邻的一名角色是否令你摸一张牌，若其选否，你视为对其使用一张火【杀】。",


  ["#lb_zero__lieshi"] = "烈势：你可以令 %src 摸一张牌，或取消后其视为对你使用一张火【杀】",
  ["#lb_zero__lieshi-choose"] = "烈势：令一名角色选择：1.令你摸一张牌；2.你视为对其使用一张火【杀】",
  ["@[skill_choices]lb_zero__lieshi"] = "烈势",

  ["#lb_zero__lieshi1"] = "基",
  ["#lb_zero__lieshi2"] = "锦",
  ["#lb_zero__lieshi3"] = "装",

  ["$lb_zero__lieshi1"] = "粉碎！",
  ["$lb_zero__lieshi2"] = "哼，别眨眼。",
  ["$lb_zero__lieshi3"] = "站稳了。",
  ["$lb_zero__lieshi4"] = "走开！",
}
skel:addEffect(fk.CardUsing, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and not data.card:isRuleVirtual()
        and player:usedSkillTimes(skel.name) == 0
        and table.find(player.room:getOtherPlayers(player), function(to)
          return to.id == player:getNextAlive().id or to.id == player:getLastAlive().id
        end)
    --[[
    and skel:withinBranchTimesLimit(player, data.card:getTypeString(), Player.HistoryRound)
    and table.find(player.room:getOtherPlayers(player), function (to)
      return player:distanceTo(to) <= 1
    end)
    --]]
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local tos = table.filter(player.room:getOtherPlayers(player), function(to)  -- 虽然不可能，还是判空
      return to.id == player:getNextAlive().id or to.id == player:getLastAlive().id
    end)
    if #tos > 0 then
      if #tos > 1 then
        tos = room:askToChoosePlayers(player, {
          targets = tos,
          min_num = 1,
          max_num = 1,
          skill_name = skel.name,
          prompt = "#lb_zero__lieshi-choose",
          cancelable = false,
        })
      end
      event:setCostData(self, { tos = tos })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player:addSkillBranchUseHistory(skel.name, data.card:getTypeString())
    local room = player.room
    --[[
    local tos = table.filter(room:getOtherPlayers(player), function(to)
      return player:distanceTo(to) <= 1
    end)
    --]]
    local tos = event:getCostData(self).tos
    room:notifySkillInvoked(player, skel.name, "offensive", tos)
    player:broadcastSkillInvoke(skel.name)
    for _, to in ipairs(tos) do
      if player.dead then return end
      if to:isAlive() then
        if room:askToSkillInvoke(to, { skill_name = skel.name, prompt = "#lb_zero__lieshi:" .. player.id }) then
          player:drawCards(1, skel.name)
        else
          room:useVirtualCard("fire__slash", nil, player, to, skel.name, true)
        end
      end
    end
  end,
})
--[[
skel:addAcquireEffect(function(self, player, is_start)
  local list = {
    ["name"] = skel.name,
    ["scope"] = Player.HistoryRound,
    ["choices"] = { { "basic", "#lb_zero__lieshi1" }, { "trick", "#lb_zero__lieshi2" }, { "equip", "#lb_zero__lieshi3" } },
    ["sep"] = "/",
  }
  player.room:setPlayerMark(player, "@[skill_choices]lb_zero__lieshi", list)
end)

skel:addLoseEffect(function(self, player, is_death)
  player.room:setPlayerMark(player, "@[skill_choices]lb_zero__lieshi", 0)
end)
--]]

return skel
